package br.com.felix.filediff;

import java.io.File;
import java.io.FilenameFilter;

/**
 * Filter a file that have a certain name.
 * */
public class SingleFileFilenameFilter implements FilenameFilter {

	/**
	 * The filename that will be used as filter.
	 * */
	private String fileName;
	
	/**
	 * Instatiates a SingleFilenameFilter.
	 * @param file is the file which name will be used as a filter.
	 * */
	public SingleFileFilenameFilter(File file){
		this.fileName = file.getName();
	}
	
	
	/**
	 * Returns true if name equals fileName (the filter).
	 * */
	public boolean accept(File dir, String name) {
		return fileName.equals(name);
	}

}
